<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
<div onmouseover="overfn()" onmouseout="outfn()"
    onmousedown="downfn()" onmouseup="upfn()" onmousemove="movefn()"></div>
<input type="text"  onkeydown="kdfn()" onkeyup="kufn()"
    onblur="blurfn()">
<select id="s1" onchange="changefn()">
    <option>北京</option>
    <option>上海</option>
    <option>广州</option>
</select>
<h1>66</h1>
<script>
    function changefn() {
        /*得到两个元素对象*/
        let s=document.querySelector("#s1")
        let h=document.querySelector("h1")
        //把下拉选的值给到h1
        h.innerText=s.value;
    }
    function blurfn() {
        //onblur失去焦点事件
        alert("编辑完成")
    }
    function kdfn() {
        //得到按键编码
        console.log("键盘按下:"+event.keyCode)
    }
    function kufn() {
        //将按键编码转成字符
        console.log("键盘抬起"+String.fromCharCode(event.keyCode));
    }
    function overfn() {
        console.log("鼠标移入")

    }
    function outfn() {
        console.log("鼠标移出")
    }
    function downfn() {
        console.log("鼠标按下")
    }
    function upfn() {
        console.log("鼠标抬起")
    }
    function movefn() {
        console.log("鼠标移动")
    }

</script>
</body>
</html>